<template>
    <div class="toast">
      <i :class="getType"></i>
      <span>{{toastMsg}}</span>
    </div>
</template>
<!-- success :  iconfont icon-toast_chenggong

warning :  iconfont icon-toast-jinggao

danger  :  iconfont icon-toast-shibai_huaban -->
<script>
import {mapState} from "vuex"
export default {
  data() {
    return {
    }
  },
  computed:{
    ...mapState({
      toastMsg:state=>state.toastStatus.toastMsg,
      toastType:state=>state.toastStatus.toastType,
    }),
    getType(){
      if(this.toastType==="success"){
        return "iconfont icon-toast_chenggong"
      }else if(this.toastType==="warning"){
        return "iconfont icon-toast-jinggao"
      }else{
        return "iconfont icon-toast-shibai_huaban"
      }
    }
  },
  methods:{

  }
}
</script>
 
<style lang="less" scoped>
.toast{
  position: fixed;
  padding: 10px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border-radius: 10px;

  .iconfont{
    margin-right: 10px;
  }

  .icon-toast-shibai_huaban{
    color: red;
  }

  .icon-toast_chenggong{
    color: green;
  }

  .icon-toast-jinggao{
    color: orange;
  }
}
</style>